<template>
	<view class="product">
		<view class="item" v-for="item in listData" :key="item.id" 
		@tap="goinfo(item.id)">
			<image :src="item.img" class="pimg"></image>
			<view class="title">{{item.name}}</view>
			<view class="subtitle">{{item.des}}</view>
			<view>
				<text class="oldp">{{item.oldPrice}}</text>
				<text class="newp">{{item.price}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			listData:{
				type:Array,
				required:true,
				default:[]
			}
		},
		methods:{
			goinfo(aid){
				console.log(aid);
				uni.navigateTo({
					url: '/pages/info/info?id='+aid
				});
			}
		}
	}
</script>

<style>
	.product{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-around;
		background-color: #ddd;
	}
	.product .item{
		width:46%;
		background-color: #fff;
		margin-top:30rpx;
		border-radius:10rpx;
	}
	.product .pimg{
		width:90%;
	} 
</style>
